<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
        <input type="text" name="" id="text"><span id="txt"></span>
        <script>
            function $(e){
                return document.querySelector(e)
            }
            var reg = /^[1-9]\d{14}(\d{2}[0-9X])?$/
            $('#text').onkeyup=function(){
                if(reg.test(this.value)){
                $('#txt').innerText='OK'
            }else{
                $('#txt').innerText='NO'
            }
        }
        </script>
</body>
</html>